/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Clases;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author user
 */
@Entity
@Table(name = "pqr")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Pqr.findAll", query = "SELECT p FROM Pqr p"),
    @NamedQuery(name = "Pqr.findByIdPqr", query = "SELECT p FROM Pqr p WHERE p.idPqr = :idPqr"),
    @NamedQuery(name = "Pqr.findByNombre", query = "SELECT p FROM Pqr p WHERE p.nombre = :nombre"),
    @NamedQuery(name = "Pqr.findByMotivo", query = "SELECT p FROM Pqr p WHERE p.motivo = :motivo")})
public class Pqr implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id_pqr")
    private String idPqr;
    @Basic(optional = false)
    @Column(name = "nombre")
    private String nombre;
    @Basic(optional = false)
    @Column(name = "motivo")
    private String motivo;
    @JoinColumn(name = "responsable", referencedColumnName = "cod_user")
    @ManyToOne(optional = false)
    private Usuario responsable;
    @JoinColumn(name = "estacion", referencedColumnName = "cod_estacion")
    @ManyToOne(optional = false)
    private Estacion estacion;

    public Pqr() {
    }

    public Pqr(String idPqr) {
        this.idPqr = idPqr;
    }

    public Pqr(String idPqr, String nombre, String motivo) {
        this.idPqr = idPqr;
        this.nombre = nombre;
        this.motivo = motivo;
    }

    public String getIdPqr() {
        return idPqr;
    }

    public void setIdPqr(String idPqr) {
        this.idPqr = idPqr;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getMotivo() {
        return motivo;
    }

    public void setMotivo(String motivo) {
        this.motivo = motivo;
    }

    public Usuario getResponsable() {
        return responsable;
    }

    public void setResponsable(Usuario responsable) {
        this.responsable = responsable;
    }

    public Estacion getEstacion() {
        return estacion;
    }

    public void setEstacion(Estacion estacion) {
        this.estacion = estacion;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idPqr != null ? idPqr.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Pqr)) {
            return false;
        }
        Pqr other = (Pqr) object;
        if ((this.idPqr == null && other.idPqr != null) || (this.idPqr != null && !this.idPqr.equals(other.idPqr))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Clases.Pqr[ idPqr=" + idPqr + " ]";
    }
    
}
